package com.wbt.design.patterns.obverser.test02;

/**
 * @program: spring
 * @description: 具体观察者（Concrete Observer）角色：实现抽象观察者中定义的抽象方法，以便在得到目标的更改通知时更新自身的状态。
 * @author: Wang·Baotong
 * @create: 2021-07-05 14:44
 */
public class BinaryObserver extends Observer {

    public BinaryObserver(Subject subject){
        this.subject = subject;
        this.subject.add(this);
    }

    @Override
    public void response() {
        System.out.println( "Binary String: "
                + Integer.toBinaryString( subject.getState() ) );
    }

    @Override
    public void response(Subject subject) {
        System.out.println( "Binary String: "
                + Integer.toBinaryString( subject.getState() ) );
    }
}
